import java.io.*;

public class IOTest01 {
    public static void main(String[] args) {
        FileInputStream fileInputStream = null;
        try {
            fileInputStream = new FileInputStream("C:\\Users\\30539\\Desktop\\text.txt");
            //开始读取数据 调用read方法
            int readData = 0;
            while(readData!=-1)
            {
                readData = fileInputStream.read();
                System.out.println(readData);
            }
            System.out.println(readData);
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (fileInputStream != null) {
                try {
                    fileInputStream.close();
                }
                catch (IOException e){
                    e.printStackTrace();
                }
            }
        }
    }
}